package com.woniuxy.cloud.boss.controller;

import com.woniu.cloud.movie.api.MovieApi;
import com.woniu.cloud.movie.api.dto.Result;
import com.woniu.cloud.movie.api.exception.mv.MovieException;
import com.woniu.cloud.movie.api.param.movieParam.MovieAddParam;
import com.woniu.cloud.movie.api.param.movieParam.MovieChangeParam;
import com.woniu.cloud.movie.api.param.movieParam.MovieLikeGetsParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName 类名： BossController
 * @Description 描述：
 * @Author haotian
 * @Date 时间：2022/1/11 6:27 下午
 * @Param 参数：
 * @Retrun 返回：
 **/
@RestController
@RequestMapping("boss")
public class BossController {
    @Resource
    private MovieApi movieFeign;

    /**
    * @作者: haotian
    * @描述：添加movie
    * @时间：2022/1/11 6:35 下午
    * @参数：[movieAddParam]
    * @参数类型:[com.woniuxy.cloud.boss.param.movieParam.MovieAddParam]
    * @返回：com.woniuxy.cloud.boss.entity.Result
    **/
    @PostMapping("addMovie")
    public Result addMovie(@RequestBody MovieAddParam movieAddParam) throws MovieException {
        Result result = movieFeign.addMovie(movieAddParam);
        return result;
    }
    /**
    * @作者: haotian
    * @描述：删除movie
    * @时间：2022/1/11 6:39 下午
    * @参数：[id]
    * @参数类型:[java.lang.Integer]
    * @返回：com.woniuxy.cloud.boss.entity.Result
    **/
    @DeleteMapping("delMovie/{id}")
    public Result delMovie(@PathVariable Integer id) throws MovieException {
        Result result = movieFeign.deleteMovie(id);
        return result;
    }
    /**
    * @作者: haotian
    * @描述：更改movie
    * @时间：2022/1/11 6:39 下午
    * @参数：[movieChangeParam]
    * @参数类型:[com.woniuxy.cloud.boss.param.movieParam.MovieChangeParam]
    * @返回：com.woniuxy.cloud.boss.entity.Result
    **/
    @PutMapping("editMovie")
    public Result editMovie(@RequestBody MovieChangeParam movieChangeParam) throws MovieException {
        Result result = movieFeign.changeMovie(movieChangeParam);
        return result;
    }
    /**
    * @作者: haotian
    * @描述：得到movie
    * @时间：2022/1/11 6:39 下午
    * @参数：[movieLikeGetsParam]
    * @参数类型:[com.woniuxy.cloud.boss.param.movieParam.MovieLikeGetsParam]
    * @返回：com.woniuxy.cloud.boss.entity.Result
    **/
    @GetMapping("getMovies")
    public Result getMovies(@RequestBody MovieLikeGetsParam movieLikeGetsParam) throws MovieException {
        Result result = movieFeign.likeMovie(movieLikeGetsParam);
        return result;
    }

}
